<include file="public/head"/>
<include file="public/scripts"/>
<style type="text/css">
    .pic-list li {
        margin-bottom: 5px;
    }
</style>
<script type="text/html" id="photos-item-tpl">
    <li id="saved-image{id}">
        <input id="photo-{id}" type="hidden" name="img_urls[]" value="{filepath}">
        <input class="form-control" id="photo-{id}-name" type="text" name="img_names[]" value="{name}"
               style="width: 200px;" title="图片名称">
        <img id="photo-{id}-preview" src="{url}" style="height:36px;width: 36px;"
             onclick="imagePreviewDialog(this.src);">
        <a href="javascript:uploadOneImage('图片上传','#photo-{id}');">替换</a>
        <a href="javascript:(function(){$('#saved-image{id}').remove();})();">移除</a>
    </li>
</script>

</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li><a href="{:cmf_plugin_url('QbtAppUpdate://AdminIndex/index')}">app更新</a></li>
        <li class="active"><a href="">版本添加</a></li>
    </ul>
    <form action="{:cmf_plugin_url('QbtAppUpdate://AdminIndex/add_post')}" method="post" class=" form-horizontal  js-ajax-form margin-top-20">
        <div class="row">
            <div class="col-md-9">
                <table class="table table-bordered">
                    <tr>
                        <th>所属类型</th>
                        <td>
                            <select name="type" id="sel">
                                <option value="1">安卓</option>
                                <option value="2">ios</option>
                                <option value="3">小程序</option>
                            </select>

                        </td>
                    </tr>

                    <script>
                        $('#sel').change(function(){
                            var value = $(this).val();
                            if(value == 2 || value == 3){
                                $("input[name='app_name']").val('');
                                $("input[name='version_code']").val('');
                                $('.box').show();
                                $('.apk_box').hide();
                                $('.hqsgf').hide();
                                $('.must').hide();
                                if(value == 2){
                                    $('.ios_url').show();
                                }else{
                                    $('.ios_url').hide();
                                }

                            }else{
                                $('.box').hide();
                                $('.apk_box').show();
                                $('.hqsgf').show();
                                $('.must').show();
                                $('.ios_url').hide();
                            }
                        })
                    </script>
                    <tr>
                        <th>api标识：</th>
                        <td>
                            <input type="text" class="form-control" name="iden" placeholder="">
                        </td>
                    </tr>
                    <tr class="box" style="display: none"><th>名称：</th><td><input type="text" class="form-control" name="app_name1"></td></tr>
                    <tr class="box" style="display: none"><th>版本号：</th><td><input type="text" class="form-control" name="version_code1"></td></tr>

                    <tr class="apk_box">
                        <th>apk包</th>
                        <td>
                            <input type="file" name="apk_url" value="">
                        </td>
                    </tr>

                    <tr class="hqsgf">
                        <th>名称：</th>
                        <td><input type="text" name="app_name" class="form-control"><p class="help-block">若在安卓时填写名称，包名，版本名称，版本号，那将变成手动获取，请将填项填写完整！</p></td>
                    </tr>
                    <tr class="hqsgf">
                        <th>包名：</th>
                        <td><input type="text" name="packge_name" class="form-control"></td>

                    </tr>
                    <tr class="hqsgf">
                        <th>版本名称：</th>
                        <td><input type="text" name="version_name" class="form-control"></td>
                    </tr>
                    <tr class="hqsgf">
                        <th>版本号：</th>
                        <td><input type="text" name="version_code" class="form-control"></td>
                    </tr>

                    <tr class="ios_url" style="display: none">
                        <th>版本更新地址：</th>
                        <td>
                            <input type="text" name="apk_url" class="form-control">
                        </td>
                    </tr>

                    <tr>
                        <th>强制更新：</th>
                        <td>
                            <input type="checkbox" name="force" value="1">
                        </td>
                    </tr>

                    <tr>
                        <th>更新备注：</th>
                        <td>
                            <textarea name="upgrade_point" id="" cols="100" rows="5"></textarea>
                        </td>
                    </tr>

                </table>
                <div class="form-group">
                    <div class="col-sm-offset-2 col-sm-10">
                        <button type="submit" class="btn btn-primary js-ajax-submit">保存</button>
                        <a class="btn btn-default" href="javascript:history.back(-1)">{:lang('BACK')}</a>
                    </div>
                </div>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript" src="__STATIC__/js/admin.js"></script>
<script type="text/javascript" src="__STATIC__/js/layer/layer.js"></script>

</body>
</html>
